package com.yhj.reggie.mapper;

import com.yhj.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    //添加用户
    @Insert("insert into user(id,phone,status) values(null,#{phone},#{status}) ")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    Integer saveUser(User user);

    //根据手机找用户
    @Select("select * from user where phone=#{phone}")
    User findByPhone(String phone);

    //根据用户id找到User对象
    @Select("select * from user where id=#{id}")
    User findByid(Long id);
}
